var BaseController = new require("./basecontroller");


function Controller() {
	BaseController.call(this);
}

Controller.prototype = Object.create(BaseController.prototype);
Controller.prototype.constructor = Controller;
Controller.prototype.FORM_ENTRIES = Array();
Controller.prototype.SEARCH_ENTRIES = Array("username", "company", "price", "date_added", "bid_pack.name");
Controller.prototype.TABLE = "payment"; // table for this controller
Controller.prototype.CONTROLLER = "backend"; // controllername
Controller.prototype.PAGE = Controller.prototype.CONTROLLER;
Controller.prototype.FORM_VIEW = "";
Controller.prototype.LIST_VIEW = "backend/test";
Controller.prototype.RECORDS_PER_PAGE = 3;

Controller.prototype.processReferenceData = function(data, referenceData, callback) {
	referenceData["test"] = "haha";
	return referenceData;
}


Controller.prototype.LIST_JOIN_TABLES = 
{	"bid_pack_id" : //field
	{ 							
		table : "bid_pack",//table
		joinType : "left",
		fields : Array('id', 'name')
	// fields to retrieve
	},
    "added_by":
    {
		table : "user",//table
		joinType : "left",
		fields: Array('id','firstname','lastname')//fields to retrieve
	}

/*
 * other joining table
 * 
 */
};



//for reference data
Controller.prototype.REFERENCE_DATA_LIST = {
		0 : {name : "transactionSummary", query : "select sum(price) as price from payment obj where archived = 1", appendCustomWhereClause: true} ,
		1 : {name : "companyList", query : "SELECT id, `name`, `key` FROM company obj WHERE obj.archived = 1 ", appendCustomWhereClause: true}
}

Controller.prototype.FORM_JOIN_TABLES = Controller.prototype.LIST_JOIN_TABLES;

module.exports = new Controller();